#ifndef SWEGL_FIXED_ARRAY_H
#define SWEGL_FIXED_ARRAY_H

#include "swegl/common.h"

namespace swegl
{

template<typename T, size_t TCapacity>
class FixedArray
{
public:
	FixedArray();
	FixedArray(const T *array, size_t n);

	size_t size() const;

	T &operator[](size_t i);
	const T &operator[](size_t i) const;

private:
	T m_begin[TCapacity];
};

template<typename T, size_t TCapacity>
inline FixedArray<T, TCapacity>::FixedArray()
{
}

template<typename T, size_t TCapacity>
inline FixedArray<T, TCapacity>::FixedArray(const T *array, size_t n)
{
	sweglAssert(n < TCapacity);
	for (size_t i = 0; i < n; i++)
	{
		m_begin[i] = array[i];
	}
}

template<typename T, size_t TCapacity>
inline size_t FixedArray<T, TCapacity>::size() const
{
	return TCapacity;
}

template<typename T, size_t TCapacity>
inline T &FixedArray<T, TCapacity>::operator[](size_t i)
{
        sweglAssert(i < TCapacity);
        return m_begin[i];
}
template<typename T, size_t TCapacity>
inline const T &FixedArray<T, TCapacity>::operator[](size_t i) const
{
        sweglAssert(i < TCapacity);
        return m_begin[i];
}

}

#endif
